package nuc.edu.tlias.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import nuc.edu.tlias.mapper.OperateLogMapper;
import nuc.edu.tlias.pojo.OperateLog;
import nuc.edu.tlias.pojo.PageResult;
import nuc.edu.tlias.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    OperateLogMapper operateLogMapper;

    @Override
    public PageResult<OperateLog> findall( Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);

        List<OperateLog> list = operateLogMapper.findall();

        Page<OperateLog> p = (Page<OperateLog>) list;

        return new PageResult<>(p.getTotal(),p.getResult());

    }
}
